package com.ydl.shopping.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 用户角色表
 *
 * @author 林武泰
 */
@Data
@TableName("tb_user_role")
@Schema(name = "用户角色表")
public class TbUserRole {
    /** 主键 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId("id")
    @Schema(description = "主键")
    private Long id;

    /** 用户编号 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField("user_id")
    @Schema(description = "用户编号")
    private Long userId;

    /** 角色编号 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField("role_id")
    @Schema(description = "角色编号")
    private Long roleId;

    @TableField(exist = false)
    private TbUser tbUser;

    @TableField(exist = false)
    private TbRole tbRole;

    public TbUserRole() {
    }

    public TbUserRole(Long userId, Long roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }
}
